package com.yxq.mdt.app.modules.personal.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalBean;

import java.util.List;

public class MainPersonalListAdapter extends BaseQuickAdapter<MainPersonalBean, BaseViewHolder> {

    public MainPersonalListAdapter(List<MainPersonalBean> data) {
        super(data);

    }
    @Override
    protected BaseViewHolder onCreateDefViewHolder(ViewGroup parent, int viewType) {
        //加载item 布局文件
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.personal_list_item, parent, false);
        return new BaseViewHolder(view);
    }

    @Override
    protected void convert(BaseViewHolder helper, MainPersonalBean item) {
        ImageView icon = helper.getView(R.id.personal_item_img);
        icon.setImageResource(item.getImg());
        helper.setText(R.id.personal_item_text, item.getText());
    }
}
